<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>广东省传播平台-媒体资源录入页</title>
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/common.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/tag.css" />
		<script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.js"></script>
		<link href="<%=path%>/js/My97DatePicker/skin/WdatePicker.css"
			rel="stylesheet" type="text/css" />
		<script type="text/javascript"
			src="<%=path%>/js/My97DatePicker/WdatePicker.js"></script>
		<link type="text/css"
			href="<%=path%>/js/jquery-ui-1.8.21.custom/css/smoothness/jquery-ui-1.8.21.custom.css"
			rel="stylesheet" />
		<script type="text/javascript"
			src="<%=path%>/js/jquery-ui-1.8.21.custom/js/jquery-ui-1.8.21.custom.min.js"></script>
		<link type="text/css" rel="stylesheet"
			href="<%=path%>/js/validator/style/validator.css"></link>
		<script src="<%=path%>/js/validator/formValidator-4.0.1.js"
			type="text/javascript" charset="UTF-8"></script>
		<script src="<%=path%>/js/validator/formValidatorRegex.js"
			type="text/javascript" charset="UTF-8"></script>
		<style type="text/css">
.add_div {
	padding: 0px 0;
	border: 1px solid #0078b6;
}

.add_div .table_add {
	width: 100%;
}

.add_div .table_add tr {
	height: 40px;
}

.add_div .table_add th {
	padding: 0px 0;
	text-align: right;
	color: #000000;
	font-size: 14px;
}

.add_div .table_add td {
	padding: 0px 0;
}
</style>
<script type="text/javascript">
	$(document).ready(function(){  
   //禁止退格键 作用于Firefox、Opera    
    document.onkeypress = banBackSpace;  
   //禁止退格键 作用于IE、Chrome   
	  document.onkeydown = banBackSpace;  
	});
	//处理键盘事件 禁止后退键（Backspace）密码或单行、多行文本框除外 
function banBackSpace(e){
	//alert(event.keyCode)
    var ev = e || window.event;//获取event对象   
    var obj = ev.target || ev.srcElement;//获取事件源     
    var t = obj.type || obj.getAttribute('type');//获取事件源类型     
    //获取作为判断条件的事件类型 
    var vReadOnly = obj.readOnly;
    var vDisabled = obj.disabled;
    //处理undefined值情况 
    vReadOnly = (vReadOnly == undefined) ? false : vReadOnly;
    vDisabled = (vDisabled == undefined) ? true : vDisabled;
    //当敲Backspace键时，事件源类型为密码或单行、多行文本的，  
    //并且readOnly属性为true或disabled属性为true的，则退格键失效  
    var flag1 = ev.keyCode == 8 && (t == "password" || t == "text" || t == "textarea") && (vReadOnly == true || vDisabled == true);
    //当敲Backspace键时，事件源类型非密码或单行、多行文本的，则退格键失效    
    var flag2 = ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea";
    //判断    
    if (flag2 || flag1) 
        event.returnValue = false;//这里如果写 return false 无法实现效果 
}
</script>

<script type="text/javascript">
	$(function(){
				$('#dialog').dialog({
					autoOpen: false,
					width: 400,
					height: 410,
					//show:"slide",
					show: "slide",
					hide:"blind"
			        //hide: "explode"
					//position: [800,220]  //显示位置
					//modal: true, overlay: { opacity: 0.5, background: "black" } ,	
				});
				$('#dialog_link').click(function(){
					$('#dialog').dialog('open');
					return false;
				})
				
			if('${mediaPrice.mediaAgent}'!=null && '${mediaPrice.mediaAgent}' !=''){
				document.getElementById("mediaProvider").readOnly= false;//供应商只读
			}
	});
</script>
		<script type="text/javascript">
	function xiangmuDBlclick(){
		$("#dialog_link").val($("#xiangmuId").val());
		document.getElementById("dialog_link").focus();
		var b = document.getElementById("xiangmuId").value;
		$.getJSON("findAllMediasummByIDAction!findAllMediasummByID.action?"+ new Date(),{contractID:b},function(data){
			$("input[name='mediaPrice.city']").val(data.contract.contractCity);//城市需要录入值
			$("#mediaPurchaseTypeHidden").val(data.contract.contractType);
			$.each(data.citylist,function(i,value){
				if(value.id == data.contract.contractCity){
					$("#city").val(value.datavalue); //显示的城市
				}
			});
			
			//$("#payModeId").val(data.contract.contractPayment); //付款方式
			$.each(data.payModeList,function(i,value){
				if(value.id == data.contract.contractPayment){
					$("#payModeName").val(value.datavalue); //显示的城市
				}
			});
			
			$.each(data.mediaPurchaseTypeList,function(i,value){
				if(value.id == data.contract.contractType){
					$("#mediaPurchaseType").val(value.datavalue); //统购类型
				}
			});
			
			$("#years").val(data.contract.contractYear); //签约年份
			$("#mediaStartTime").val(data.contract.contractStartTime.substring(0,10));//开始时间
			$("#mediaEndTime").val(data.contract.contractEndTime.substring(0,10));//结束时间
			if(data.contract.contractBType==1){//代理商
				$("#mediaProvider").val(data.contract.contractBName);//供应商
				document.getElementById("mediaProvider").readOnly= true;//供应商只读
				document.getElementById("mediaAgent").readOnly= true;//代理商只读
				$("#mediaAgent").val("");//代理商
			}
			if(data.contract.contractBType==2){
				$("#mediaProvider").val("${mediaPrice.mediasumm.mediaProvider}");//供应商
				$("#mediaAgent").val(data.contract.contractBName);//代理商
				document.getElementById("mediaAgent").readOnly= true;//代理商只读
				document.getElementById("mediaProvider").readOnly= false;//供应商
			}
		});
		$("#dialog").dialog("close");
	}
	function findAllContract(){
		$.getJSON("findAllMediasummByNameAction!findAllMediasummByName.action?"+ new Date(),{contractName:$("#contractName").val()},function(data){
			//清空显示层中的数据
			$("#xiangmuId").html("");
			$.each(data.contractList,function(i,value){
				$("#xiangmuId").append($("<option value='" + value.contractID + "'>" + value.contractName + "</option>"));
			});
		});
	}
	
</script>


<script type="text/javascript">
//随单
//在id为test的table的最后增加一行    
	function addSuiDan(id){    
		var num = new RegExp("^[0-9]*$");
		tr_id = $("#"+id+">tbody>tr:last").attr("id");
		//alert(tr_id);
		var tdValue=$("#suiDanShang"+tr_id).val(); //上次的上限值
		tr_id++; 
		//alert(tdValue+"_"+tr_id);
		if(tdValue !=""){
		//alert($("#suiDanShang"+(tr_id-1)).val());
		//alert($("#suiDanXia"+(tr_id-1)).val());
		if(num.test($("#suiDanShang"+(tr_id-1)).val())){
		if(parseInt($("#suiDanShang"+(tr_id-1)).val()) - parseInt($("#suiDanXia"+(tr_id-1)).val()) > 0){
			document.getElementById("suiDanShang"+(tr_id-1)).readOnly= true;//当前上限值只读
			//$("#suiDanShang"+(tr_id-1)).attr("readonly":"readonly");
		
		var str = "<tr id = '"+tr_id+"'><td width='100%' style='padding-left:175px;'><b style='font-size:14px;color: black'>年投放量：&nbsp;&nbsp;<input maxlength='5' name='suiDan_01' id='suiDanXia"+tr_id+"' value='"+tdValue+"' type='text' class='text' style='text-align:center; color:#0078B6;' readonly='readonly'/>&nbsp;&nbsp;万&nbsp;-&nbsp;&nbsp;"+
				"<input type='text' id='suiDanShang"+tr_id+"' name='suiDan_02' maxlength='5' class='text' style='text-align:center; color:#0078B6;'/>&nbsp;&nbsp;万(包含)，优惠额度：&nbsp;"+
				"<input type='text'name='suiDan_03' maxlength='10' class='text' style='text-align:center; color:#0078B6;' />&nbsp;</b></td></tr>";      
		$('#'+id).append(str);
		}else{
			alert("随单上限值不能小于或等于下限值！");
			document.getElementById("suiDanShang"+(tr_id-1)).focus();
		}
		}else{
			alert("随单上限值不是正整数！");
			document.getElementById("suiDanShang"+(tr_id-1)).focus();
		}
		}else{
			alert("随单上限值不能为空！");
			document.getElementById("suiDanShang"+(tr_id-1)).focus();
		}
	}    
		//删除id为test的table的最后一行    
	function delSuiDan(id){    
		tr_id = $("#"+id+">tbody>tr:last").attr("id");   
		if(tr_id - 100 > 0){
			$('#'+tr_id).remove();
			document.getElementById("suiDanShang"+(tr_id-1)).readOnly= false;//上一个上限值可输入
			$("#suiDanShang"+(tr_id-1)).val("");//清空上一个上限值
			document.getElementById("suiDanShang"+(tr_id-1)).focus();//获得上一个上限值焦点
			$('#'+tr_id).remove();
		}else{
			alert("随单的最后一条，不可删除！");
		}
		}    
		
		//常规
	function addChangGui(id){   
		var num = new RegExp("^[0-9]*$"); 
		tr_id = $("#"+id+">tbody>tr:last").attr("id");
		//alert(tr_id);
		var tdValue=$("#changGuiShang"+tr_id).val(); //上次的上限值
		tr_id++; 
		//alert(tdValue+"_"+tr_id);
		if(tdValue !=""){
		//alert($("#suiDanShang"+(tr_id-1)).val());
		//alert($("#suiDanXia"+(tr_id-1)).val());
		if(num.test($("#changGuiShang"+(tr_id-1)).val())){
		if(parseInt($("#changGuiShang"+(tr_id-1)).val()) - parseInt($("#changGuiXia"+(tr_id-1)).val()) > 0){
			document.getElementById("changGuiShang"+(tr_id-1)).readOnly= true;//当前上限值只读
			//$("#changGuiShang"+(tr_id-1)).attr("readonly":"readonly");
		
		var str = "<tr id = '"+tr_id+"'><td width='100%' style='padding-left:175px;'><b style='font-size:14px;color: black'>年投放量：&nbsp;<input maxlength='5' name='changGui_01' id='changGuiXia"+tr_id+"' value='"+tdValue+"' type='text' class='text' style='text-align:center; color:#0078B6;' readonly='readonly'/>&nbsp;&nbsp;万&nbsp;-&nbsp;&nbsp;"+
				"<input type='text' id='changGuiShang"+tr_id+"' name='changGui_02' maxlength='5' class='text' style='text-align:center; color:#0078B6;'/>&nbsp;&nbsp;万(包含)，优惠额度：&nbsp;"+
				"<input type='text'name='changGui_03' maxlength='10' class='text' style='text-align:center; color:#0078B6;' />&nbsp;</b></td></tr>";      
		$('#'+id).append(str);
		}else{
			alert("常规上限值不能小于或等于下限值！");
			document.getElementById("changGuiShang"+(tr_id-1)).focus();
		}
		}else{
			alert("常规上限值不是正整数！");
			document.getElementById("changGuiShang"+(tr_id-1)).focus();
		}
		}else{
			alert("常规上限值不能为空！");
			document.getElementById("changGuiShang"+(tr_id-1)).focus();
		}
	}    
		//删除id为test的table的最后一行    
	function delChangGui(id){    
		tr_id = $("#"+id+">tbody>tr:last").attr("id");   
		if(tr_id - 200 > 0){
			$('#'+tr_id).remove();
			document.getElementById("changGuiShang"+(tr_id-1)).readOnly= false;//上一个上限值可输入    
			$("#changGuiShang"+(tr_id-1)).val("");//清空上一个上限值
			document.getElementById("changGuiShang"+(tr_id-1)).focus();//获得上一个上限值焦点
		}else{
			alert("常规的最后一条，不可删除！");
		}
		} 
		
		//返还
	function addFanHuan(id){   
		var num = new RegExp("^[0-9]*$"); 
		tr_id = $("#"+id+">tbody>tr:last").attr("id");
		//alert(tr_id);
		var tdValue=$("#fanHuanShang"+tr_id).val(); //上次的上限值
		tr_id++; 
		//alert(tdValue+"_"+tr_id);
		if(tdValue !=""){
		//alert($("#suiDanShang"+(tr_id-1)).val());
		//alert($("#suiDanXia"+(tr_id-1)).val());
		if(num.test($("#fanHuanShang"+(tr_id-1)).val())){
		if(parseInt($("#fanHuanShang"+(tr_id-1)).val()) - parseInt($("#fanHuanXia"+(tr_id-1)).val()) > 0){
			document.getElementById("fanHuanShang"+(tr_id-1)).readOnly= true;//当前上限值只读
			//$("#fanHuanShang"+(tr_id-1)).attr("readonly":"readonly");
		
		var str = "<tr id = '"+tr_id+"'><td width='100%' style='padding-left:175px;'><b style='font-size:14px;color: black'>年投放量：&nbsp;<input name='fanHuan_01' maxlength='5' id='fanHuanXia"+tr_id+"' value='"+tdValue+"' type='text' class='text' style='text-align:center; color:#0078B6;' readonly='readonly'/>&nbsp;&nbsp;万&nbsp;-&nbsp;&nbsp;"+
				"<input type='text' id='fanHuanShang"+tr_id+"' name='fanHuan_02' class='text' maxlength='5' style='text-align:center; color:#0078B6;'/>&nbsp;&nbsp;万(包含)，优惠额度：&nbsp;"+
				"<input type='text'name='fanHuan_03' maxlength='10' class='text' style='text-align:center; color:#0078B6;'/>&nbsp;</b></td></tr>";      
		$('#'+id).append(str);
		}else{
			alert("返还上限值不能小于或等于下限值！");
			document.getElementById("fanHuanShang"+(tr_id-1)).focus();
		}
		}else{
			alert("返还上限值不是正整数！");
			document.getElementById("fanHuanShang"+(tr_id-1)).focus();
		}
		}else{
			alert("返还上限值不能为空！");
			document.getElementById("fanHuanShang"+(tr_id-1)).focus();
		}
	}    
	//删除id为test的table的最后一行    
	function delFanHuan(id){    
		tr_id = $("#"+id+">tbody>tr:last").attr("id");   
		if(tr_id - 400 > 0){
			$('#'+tr_id).remove();
			document.getElementById("fanHuanShang"+(tr_id-1)).readOnly= false;//上一个上限值可输入    
			$("#fanHuanShang"+(tr_id-1)).val("");//清空上一个上限值
			document.getElementById("fanHuanShang"+(tr_id-1)).focus();//获得上一个上限值焦点
		}else{
			alert("返还的最后一条，不可删除！");
		}
		} 
</script>
<script type="text/javascript">
	function zheKouSelect_01(){
		var mediaDiscountType = $("#mediaDiscountType").val();
		if(mediaDiscountType ==1){
			$("#fanhuaiBtnDiv").html("");	
			var html ="<br/><div style='padding-left:178px;'><b style='font-size:14px;color: black'>优惠额度：<input type='text' maxlength='5' class='text' id='eDuValue' name='eDuValue' style='text-align: center; color: #0078B6;' />&nbsp;%</b><br/><br/></div>";
			$("#zheKouDivID").html(html);
		}else{
			//替换
			var html = "";
			html += "<table id='fanHuan_Tab' cellpadding='4' cellspacing='4' width='100%'>";
			html += "<tr id='400'><td width='100%' style='padding-left:175px;'>";
			html +="<b style='font-size:14px;color: black'>年投放量：&nbsp;<input name='fanHuan_01' maxlength='5' type='text' class='text' id='fanHuanXia400' style='text-align: center; color: #0078B6;' value='0' readonly='readonly' />";
			html+= "&nbsp; 万&nbsp;-&nbsp; <input type='text' class='text' maxlength='5' name='fanHuan_02' id='fanHuanShang400' style='text-align: center; color: #0078B6;' />";
			html+="&nbsp; 万(包含)，优惠额度：&nbsp;<input type='text' maxlength='10' class='text' name='fanHuan_03' style='text-align: center; color: #0078B6;' />&nbsp;";
			html+="</b></td></tr></table>";
			$("#fanhuaiBtnDiv").html("&nbsp;&nbsp;&nbsp;<input type='button' value='新增' onclick=addFanHuan('fanHuan_Tab')>&nbsp;&nbsp;<input type='button' value='删除' onclick=delFanHuan('fanHuan_Tab')>");	
			$("#zheKouDivID").html(html);
		}
	}
</script>
<script type="text/javascript">
	function trim(str1) { //去掉空格
	var str = $.trim(str1);
	return str;
	}
	function getLen(str){
		var len=0;
		if(null!=str&&str!=""){
			for(var i=0;i<str.length;i++){
				var intCode=str.charCodeAt(i);
				//如果ASCII码等于34(")38(&)39(')47(/)60(<)62(>)92(\)也算三个字符
				if (intCode>=0&&intCode<=127&&intCode!=34&&intCode!=39&&intCode!=47&&intCode!=60&&intCode!=62&&intCode!=92){
					len=len+1;
				}else{
					len=len+3;
				}
			}
		}
		return len;
	}
	function doUpdateMediaPrice(url){
		var myReg = /^[^@\/\'\\\"#$%&\^\*<>]+$/;
		var contractNum = /^[\w-\s]+$/;
		var msgName = "2";
		var mediaName = document.getElementById("mediaName").value;//媒体名称
		var mediaNameHidden = document.getElementById("mediaNameHidden").value;//媒体名称
		if (mediaName == '') {
		alert('媒体名称不能为空！');
			return false;
		}
		
		if (!myReg.test(mediaName)) {
			alert("媒体名称不能包含：“$、#、%、/、*、<、>、'、\"、\\、& ”等特殊字符，请重新输入！");
			document.getElementById('mediaName').focus();
			return false;
		}
		
		if (getLen(mediaName) > 150) {
			alert("媒体名称应不大于50个汉字(150个字符)！");
			return false;
		}
		
		var url1 = encodeURI(encodeURI('findMediaPriceBymediaNameAction.action?mediaName=' + $.trim(mediaName))+'&'+ new Date());
		if(mediaNameHidden != mediaName){
	       $.ajax({
	               	url:url1,
	               	async:false,
	               	datatype: "json",
	               	error : function() {   
				    	alert('服务器异常！');
				    	window.location.href="toErrorAction.action";
					}, 	  
	               	success : function(data) { 
	            		if(data.message =="error"){
							alert("媒体名称重复！");
							document.getElementById("mediaName").focus();
							msgName = "1";
						}
						if(data.message =="success"){
							msgName = "2";
						}
	         }    
	       }); 
       }
		
		var mediaDescription = $.trim($("#mediaDescription").val());
		if(getLen(mediaDescription)>240){
			alert("媒体简介长度不能大于80个汉字(240个字符)！");
			document.getElementById("mediaDescription").focus();
			return false;
		}
		
		var num = new RegExp("^[0-9]*$");
		var pattern = /[^\d\.]/g;
		var suiDan_01='';
		var suiDan_02 = '';
		var suiDan_03 = '';
		
		var changGui_01='';
		var changGui_02 = '';
		var changGui_03 = '';
		
		var fanHuan_01='';
		var fanHuan_02 = '';
		var fanHuan_03 = '';
		var msgAlert = "0";//正确
		
			$("#levelLowerLimit_01").val("");//随单下限值
			$("#levelUpperLimit_01").val("");//随单上限值
			$("#levelDiscount_01").val("");//随单优惠额度
			$("#levelLowerLimit_02").val("");//常规下限值
			$("#levelUpperLimit_02").val("");//常规上限值
			$("#levelDiscount_02").val("");//常规优惠额度
			$("#levelLowerLimit_03").val("");//返还下限值
			$("#levelUpperLimit_03").val("");//返还上限值
			$("#levelDiscount_03").val("");//返还优惠额度
		
		if(document.getElementById("checkbox_01").checked){
			$("input[type='text'][name='suiDan_01']", document.forms[0]).each(function(){
				suiDan_01 += ","+$(this).val();
			}); 
			$("input[type='text'][name='suiDan_02']", document.forms[0]).each(function(){
				if($(this).val()==""){
					suiDan_02 += ","+(parseInt(0));
				}else{
					suiDan_02 += ","+$(this).val();
				}
			}); 
			$("input[type='text'][name='suiDan_03']", document.forms[0]).each(function(){
				suiDan_03 += ","+$(this).val();
			}); 
			//判断上限值文本框值
			var str_suiDan = suiDan_02.substring(1);
			var arr_suiDan = str_suiDan.split(",");
			var str_suiDan01 = suiDan_01.substring(1);//截取下限值
			var arr_suiDan01 = str_suiDan01.split(",");
			var arr_suiDan01Length = arr_suiDan01.length;//下限长度
			var str_suiDan_001 = arr_suiDan01[arr_suiDan01Length-1];//最后下限值
            var str_suiDan_002 = arr_suiDan[arr_suiDan01Length-1];//最后上限值
			if(trim(str_suiDan_002) == "0"){
				
			}else if(!num.test(trim(str_suiDan_002))){
				alert("随单上限值不是整数！");
				msgAlert ="1";  
			}else if(str_suiDan_002 - str_suiDan_001 <=0){//最后上限值不能<=最后上限值
					alert("随单上限值不能小于或等于下限值！");
					msgAlert ="1";  
				}
			
			//判断最后文本框值
			var str_1 = suiDan_03.substring(1);
			var arr = str_1.split(",");
			for(var i=0; i<arr.length;i++){
				if(arr[i]==""){
					 alert("随单优惠额度不能为空！");
					 msgAlert ="1";
					 break;
				}else {
                  if(/^(\+|-)?\d+($|\.\d+$)/.test(arr[i])) {
                    var value=parseInt(arr[i]);
                    var val=$('input:radio[name="suiDanSaleType"]:checked').val(); 
                    if(val == 1){
                    	if(value>=0&&value<=100){
	                    }else{
	                         alert("随单优惠额度应该是0-100的数！");
	                         msgAlert ="1";
	                        break;  
	                    }      
                    }
                   }else{
                    alert("随单优惠额度应该是数字！");
                    msgAlert ="1";  
					break;
                  }      
				}
			}
			
			$("#levelLowerLimit_01").val(suiDan_01.substring(1));//随单下限值
			$("#levelUpperLimit_01").val(suiDan_02.substring(1,suiDan_02.length));//随单上限值
			$("#levelDiscount_01").val(suiDan_03.substring(1));//随单优惠额度
		}
		if(document.getElementById("checkbox_02").checked){
			$("input[type='text'][name='changGui_01']", document.forms[0]).each(function(){
				changGui_01 += ","+$(this).val();
			}); 
			$("input[type='text'][name='changGui_02']", document.forms[0]).each(function(){
				if($(this).val()==""){
					changGui_02 += ","+(parseInt(0));
				}else{
					changGui_02 += ","+$(this).val();
				}
			}); 
			$("input[type='text'][name='changGui_03']", document.forms[0]).each(function(){
				changGui_03 += ","+$(this).val();
			}); 
			
			
			//判断上限文本框值
			var str_changGui = changGui_02.substring(1);
			var arr_changGui = str_changGui.split(",");
			var str_changGui01 = changGui_01.substring(1);//截取下限值
			var arr_changGui01 = str_changGui01.split(",");
			var arr_changGui01Length = arr_changGui01.length;//下限长度
			var str_changGui_001 = arr_changGui01[arr_changGui01Length-1];//最后下限值
            var str_changGui_002 = arr_changGui[arr_changGui01Length-1];//最后上限值
			if(trim(str_changGui_002) == "0"){
			}else if(!num.test(trim(str_changGui_002))){
				alert("常规上限值不是整数！");
				msgAlert ="1";  
			}else if(str_changGui_002 - str_changGui_001 <=0){//最后上限值不能<=最后上限值
					alert("常规上限值不能小于或等于下限值！");
					msgAlert ="1";  
				}
			
			//判断最后文本框值
			var str_1 = changGui_03.substring(1);
			var arr = str_1.split(",");
			for(var i=0; i<arr.length;i++){
				if(arr[i]==""){     
					 alert("常规优惠额度不能为空！");
					 msgAlert ="1";
					 break;
				}else {
                  if(/^(\+|-)?\d+($|\.\d+$)/.test(arr[i])) {
                    var value=parseInt(arr[i]);
                    var val=$('input:radio[name="changGuiSaleType"]:checked').val(); 
                    if(val == 1){
                    	if(value>=0&&value<=100){
	                    }else{
	                         alert("常规优惠额度应该是0-100的数！");
	                         msgAlert ="1";
	                        break;  
	                    }      
                    }
                   }else{
                    alert("常规优惠额度应该是数字！");
                    msgAlert ="1";
					break;
                  }      
				}
			}
			
			$("#levelLowerLimit_02").val(changGui_01.substring(1));//常规下限值
			$("#levelUpperLimit_02").val(changGui_02.substring(1,changGui_02.length));//常规上限值
			$("#levelDiscount_02").val(changGui_03.substring(1));//常规优惠额度
		}
		if(document.getElementById("checkbox_03").checked){
			if(document.getElementById("mediaDiscountType").value !=1){
			$("input[type='text'][name='fanHuan_01']", document.forms[0]).each(function(){
				fanHuan_01 += ","+$(this).val();
			}); 
			$("input[type='text'][name='fanHuan_02']", document.forms[0]).each(function(){
				if($(this).val()==""){
					fanHuan_02 += ","+(parseInt(0));
				}else{
					fanHuan_02 += ","+$(this).val();
				}
			}); 
			$("input[type='text'][name='fanHuan_03']", document.forms[0]).each(function(){
			//alert($(this).val())
				fanHuan_03 += ","+$(this).val();
			});
			
			//判断上限文本框值
			var str_fanHuan = fanHuan_02.substring(1);
			var arr_fanHuan = str_fanHuan.split(",");
			var str_fanHuan01 = fanHuan_01.substring(1);
			var arr_fanHuan01 = str_fanHuan01.split(",");
			var arr_fanHuan01Length = arr_fanHuan01.length;
			var str_fanHuan_001 = arr_fanHuan01[arr_fanHuan01Length-1];
            var str_fanHuan_002 = arr_fanHuan[arr_fanHuan01Length-1];
			if(trim(str_fanHuan_002) == "0"){
			}else if(!num.test(trim(str_fanHuan_002))){
				alert("返还上限值不是整数！");
				msgAlert ="1";  
			}else if(str_fanHuan_002 - str_fanHuan_001 <=0){
					alert("返还上限值不能小于或等于下限值！");
					msgAlert ="1";  
				}
			
			//判断最后文本框值
			var str_1 = fanHuan_03.substring(1);
			var arr = str_1.split(",");
			for(var i=0; i<arr.length;i++){
				if(arr[i]==""){     
					 alert("返还优惠额度不能为空！");
					 msgAlert ="1";
					 break;
				}else {
                  if(/^(\+|-)?\d+($|\.\d+$)/.test(arr[i])) {
                    var value=parseInt(arr[i]);
                    if(value>=0&&value<=100){
                       
                    }else{
                         alert("返还优惠额度应该是0-100的数！");
                         msgAlert ="1";
                        break;  
                    }      
                   }else{
                    alert("返还优惠额度不是整数！");
                    msgAlert ="1";  
					break;
                  }      
				}
			}
			$("#levelLowerLimit_03").val(fanHuan_01.substring(1));//返还下限值
			$("#levelUpperLimit_03").val(fanHuan_02.substring(1,fanHuan_02.length));//返还上限值
			$("#levelDiscount_03").val(fanHuan_03.substring(1));//返还优惠额度
		}else if(trim($("#eDuValue").val())==""){
				alert("返还优惠额度不能为空！");
				msgAlert ="1";
			}else if(pattern.test(trim($("#eDuValue").val()))){
				alert("返还优惠额度是整数！");
				msgAlert ="1";
			}else if($("#eDuValue").val()>100 || $("#eDuValue").val()< 0){
				alert("返还优惠额度是0-100数！");
				msgAlert ="1";
			}
		
		}
		
		if(msgName == "2" && msgAlert =="0"){
			var mediaName_001 = $.trim($("#mediaName").val());
			$("#mediaName").val(mediaName_001);
			document.forms[0].action=url;
			document.forms[0].submit();
		}
	}
	
</script>

		<script type="text/javascript">
	function checkboxClick(){
		if(document.getElementById("checkbox_01").checked){
			$("#suiDanDiv").show();
		}else{
			$("#suiDanDiv").hide();
		}
		if(document.getElementById("checkbox_02").checked){
			$("#changGuiDiv").show();
		}else{
			$("#changGuiDiv").hide();
		}
		if(document.getElementById("checkbox_03").checked){
			$("#hanHuaiDiv").show();
			if($("#eDuValueHidden").val() !=0){
				$("#eDuValue").val($("#eDuValueHidden").val());
			}else{
				$("#eDuValue").val("");
			}
		}else{
			$("#hanHuaiDiv").hide();
			$("#eDuValue").val("-1");
		}
	}
	function rewlset(){
		$("#contractName").val("");
	}
	
	function doQuXiao(){
		if(confirm('您确认取消本次操作？')){
			window.location.href='mediaPriceAction.action?currentPage=1';
		}
	}
</script>
</head>
	<body>
		<script type="text/javascript">
	$(function(){
        //selectNav('nav2');
    });
</script>
		<!-- 顶栏start -->
		<jsp:include page="../common/top.jsp"></jsp:include>
		<!-- 顶部end -->

		<!-- 顶部start -->
		<div id="main">
			<div class="body">
				<jsp:include page="../common/nav.jsp"></jsp:include>
				<!-- 主体 -->
				<form action="" method="post" id="form1">
					<input type="hidden" id="levelLowerLimit_01"
						name="levelLowerLimit_01" />
					<input type="hidden" id="levelUpperLimit_01"
						name="levelUpperLimit_01" />
					<input type="hidden" id="levelDiscount_01" name="levelDiscount_01" />

					<input type="hidden" id="levelLowerLimit_02"
						name="levelLowerLimit_02" />
					<input type="hidden" id="levelUpperLimit_02"
						name="levelUpperLimit_02" />
					<input type="hidden" id="levelDiscount_02" name="levelDiscount_02" />

					<input type="hidden" id="levelLowerLimit_03"
						name="levelLowerLimit_03" />
					<input type="hidden" id="levelUpperLimit_03"
						name="levelUpperLimit_03" />
					<input type="hidden" id="levelDiscount_03" name="levelDiscount_03" />
					<input name="mediaPrice.priceID" type="hidden" value="${mediaPrice.priceID}"/>
					<input type="hidden" value="<fmt:formatNumber   value='${eDuValue}' pattern='#.###'/>" id="eDuValueHidden"/>
					<div class="main_body">
						<div class="add_div">
							<div class="add_div"
								style="border-top-style: none; border-left-style: none; border-right-style: none;">
								<table style="width: 100%;" cellpadding="0" cellspacing="0">
									<tr
										style="height: 30px; font-size: 16px; color: #000000; background: url(<%=path%>/images/banners30.jpg) repeat;">
										<td style="padding-left: 30px;">
											<b>媒体基本信息</b>
										</td>
									</tr>
								</table>
							</div>
							<table class="table_add" style="width: 100%;">
								<tr>
									<th width="330">
										媒体名称：
									</th>
									<td>
										<input id="mediaName" type="text" name="mediasumm.mediaName"
											class="text" style="width: 200px;"
											value="${mediaPrice.mediasumm.mediaName}" maxlength="150"/>
										<input type="hidden" id="mediaNameHidden"
											value="${mediaPrice.mediasumm.mediaName}" />
										<input type="hidden" id="mediaID" class="text" name="mediasumm.mediaID"
											style="width: 200px;" value="${mediaPrice.mediaID}" readonly="readonly"/>
									</td>
									<td width="150">
										&nbsp;
									</td>
									<th width="250">
										媒体类型：
									</th>
									<td>
										<s:if test="mediumListSize == 0">
											<select name="mediasumm.mediaType" style="width:202px;">
												<s:iterator value="mediaTypeList" id="mt">
													<s:if test="#mt.id == mediaPrice.mediasumm.mediaType">
														<option value="${mt.id}" selected="selected">${mt.datavalue}</option>
													</s:if>
													<s:else>
														<option value="${mt.id}">${mt.datavalue}</option>
													</s:else>
												</s:iterator>
											</select>
										</s:if>
										<s:else>
											<s:iterator value="mediaTypeList" id="mt">
												<s:if test="#mt.id == mediaPrice.mediasumm.mediaType">
													<input type="text" value="${mt.datavalue}" class="text" style="width:200px;" readonly="readonly"/>
													<input type="hidden" name="mediasumm.mediaType" value="${mt.id}"/>
												</s:if>
											</s:iterator>
										</s:else>
									</td>
									<td width="225">
										<span style="color:red">*</span>&nbsp;
									</td>
								</tr>
								<tr>
									<th>
										合同编号：
									</th>
									<td>
										<input name="mediaPrice.contractID" type="text" class="text"
											id="dialog_link" style="width: 200px;"
											value="${mediaPrice.contractID}" readonly="readonly" />
									</td>
									<td>
										<span style="color:red">*</span>&nbsp;
									</td>
									<th>
										媒体归属：
									</th>
									<td>
										<s:select name="mediaPrice.mediaBelog" list="mediaBelogList"
											listKey="id" listValue="datavalue" cssStyle="width:202px;">
										</s:select>
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
								<tr>
									<th>
										供应商：
									</th>
									<td>
										<input name="mediasumm.mediaProvider" type="text"
											id="mediaProvider" class="text" maxlength="30" style="width: 200px;"
											value="${mediaPrice.mediasumm.mediaProvider}" readonly="readonly"/>
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										代理商：
									</th>
									<td>
										<input name="mediaPrice.mediaAgent" maxlength="30" type="text"
											id="mediaAgent" class="text" style="width: 200px;"
											value="${mediaPrice.mediaAgent}" readonly="readonly"/>
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
								<tr>
									<th>
										签约年份：
									</th>
									<td>
										<input name="mediaPrice.contractYear" id="years" type="text"
											class="text" style="width: 200px;" readonly="readonly"
											value="${mediaPrice.contractYear}" />
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										归属地市：
									</th>
									<td>
										<s:iterator id="mtl" value="citylist">
											<s:if test="#mtl.id == mediaPrice.city">
												<input id="city" type="text" class="text"
													style="width: 200px;" value="${mtl.datavalue}"
													readonly="readonly" />
											</s:if>
										</s:iterator>
										<input name="mediaPrice.city" type="hidden" readonly="readonly"
											value="${mediaPrice.city}" />
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
								<tr>
									<th>
										付款方式：
									</th>
									<td>
										<s:iterator id="mtl" value="payModeList">
											<s:if test="#mtl.id == mediaPrice.contract.contractPayment">
											<input readonly="readonly" type="text" class="text" id="payModeName" value="${mtl.datavalue}" style="width: 200px"/>
											</s:if>
										</s:iterator>
										<!-- 
										<input readonly="readonly" type="text" class="text"  name="mediaPrice.payMode" value="${mediaPrice.payMode}" id="payModeId" style="width: 200px"/>
										 -->
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										媒体统购类型：
									</th>
									<td>
									<!-- 
										<s:select name="mediaPrice.mediaPurchaseType"
											list="mediaPurchaseTypeList" listKey="id"
											listValue="datavalue" cssStyle="width:202px;">
										</s:select>
									-->
									<s:iterator id="mtl" value="mediaPurchaseTypeList">
											<s:if test="#mtl.id == mediaPrice.contract.contractType">
											<input type="text" readonly="readonly" id="mediaPurchaseType" value="${mtl.datavalue}" class="text" style="width: 200px;"/>
											</s:if>
										</s:iterator>
										<input type="hidden" name="mediaPrice.mediaPurchaseType" value="${mediaPrice.mediaPurchaseType}" id="mediaPurchaseTypeHidden"/>
									</td>
									<td>
										&nbsp;
									</td>
									
								</tr>
									<!-- 
								<tr>
									<th>
										阶梯计算周期：
									</th>
									<td>
										<s:select  
											name="mediaPrice.levelCalculatePeriod"
											list="levelCalculatePeriodList" listKey="id"
											listValue="datavalue" cssStyle="width:202px;">
										</s:select>
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										当前阶梯计算日：
									</th>
									<td>
										<input id="lastCalculateDate"
											name="mediaPrice.lastCalculateDate" type="text"
											class="text Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})" 
											style="width: 200px;"
											value="${fn:substring(mediaPrice.lastCalculateDate,0,10)}" />
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
 -->
								<tr>
									<th>
										开始时间：
									</th>
									<td>
										<input name="mediaPrice.mediaStartTime" id="mediaStartTime"
											class="text" type="text"
											style="width: 200px;"
											value="${fn:substring(mediaPrice.mediaStartTime,0,10)}"
											readonly="readonly" />
									<td>
										&nbsp;
									</td>
									<th>
										截止时间：
									</th>
									<td>
										<input name="mediaPrice.mediaEndTime" id="mediaEndTime"
											class="text" type="text"
											style="width: 200px;"
											value="${fn:substring(mediaPrice.mediaEndTime,0,10)}"
											readonly="readonly" />
									<td>
										&nbsp;
									</td>
								</tr>
								<tr>
									<th>
										媒体资源类型：
									</th>
									<td>
										<s:select name="mediaPrice.mediaResourceType"
											list="mediaResourceTypeList" listKey="id"
											listValue="datavalue" cssStyle="width:202px;">
										</s:select>
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										使用总金额：
									</th>
									<td>
										<input type="text" readonly="readonly"  value="<fmt:formatNumber value='${mediaPrice.totalPay}'/>" style="width: 200px;" class="text"/>
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
								<tr>
								<th>
										媒体折扣类型：
									</th>
									<td>
										<s:select id="mediaDiscountType"
											name="mediaPrice.mediaDiscountType"
											list="mediaDiscountTypeList" listKey="id"
											listValue="datavalue" cssStyle="width:202px;" onchange="zheKouSelect_01();">
										</s:select>
									</td>
									<td>
										&nbsp;
									</td>
									<th>
										&nbsp;
									</th>
									<td>
										&nbsp;
									</td>
									<td>
										&nbsp;
									</td>
									</tr>
								<tr>
									<th>
										媒体简介：
									</th>
									<td colspan="5" style="text-align: left;">
										<s:textarea id="mediaDescription" name="mediasumm.mediaDescription" value="%{mediaPrice.mediasumm.mediaDescription}" 
										cssStyle="width:647px; font-family: '微软雅黑'; font-size: 12px; font-weight: bold; color: #666666;text-align: left;">
										</s:textarea>
										<!-- 
										<textarea id="mediaDescription" name="mediasumm.mediaDescription" 
											style="width:647px; font-family: '微软雅黑'; font-size: 12px; font-weight: bold; color: #666666;text-align: left;">
												${mediaPrice.mediasumm.mediaDescription}
										</textarea>
										 -->
									</td>
								</tr>
								<tr>
									<th style="width: 200px;">
										优惠方式：
									</th>
									<th colspan="5" style="text-align: left;">
										
										<input id="checkbox_01" type="checkbox" <c:if test='${suiDanListSize gt 0}'>checked='checked'</c:if>" onclick="checkboxClick();" />
										&nbsp;&nbsp;随单赠送 &nbsp;&nbsp;&nbsp;&nbsp;
										<input id="checkbox_02" type="checkbox" <c:if test='${changGuiListSize gt 0}'>checked='checked'</c:if> onclick="checkboxClick();" />
										&nbsp;&nbsp;常规赠送 &nbsp;&nbsp;&nbsp;&nbsp;
										<input id="checkbox_03" type="checkbox" <c:if test='${fanHuaiListSize gt 0}'>checked='checked'</c:if> onclick="checkboxClick();" />
										&nbsp;&nbsp;返还赠送
									</th>
								</tr>
							</table>
							<div id="suiDanDiv" style="<c:if test='${suiDanListSize gt 0}'>display:block;</c:if>
							<c:if test='${suiDanListSize le 0}'>display:none;</c:if>">
								<div class="add_div"
									style="border-left-style: none; border-right-style: none;">
									<table style="width: 100%;" cellpadding="0" cellspacing="0" >
										<tr
											style="height:30px; font-size: 16px; color: #000000; background: url(<%=path%>/images/banners30.jpg) repeat;">
											<td style="padding-left: 30px;">
												<b>随单赠送</b>&nbsp;&nbsp;&nbsp;
												<input type="button" value="新增" onclick="addSuiDan('suiDan_Tab');" />
												&nbsp;<input type="button" value="删除" onclick="delSuiDan('suiDan_Tab');" />
											</td>
										</tr>
									</table>
								</div>
								<table class="table_add" width="100%">
									<tr>
									<th style="width: 300px;">
										是否累计：
									</th>
									<td width="200">
										<s:select name="mediaPrice.promotionAAccumulat"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="150">&nbsp;</td>
									<th style="width:250px;">
										时间是否可调：
									</th>
									<td>
										<s:select name="mediaPrice.promotionAValidDateAdjustable"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="250">&nbsp;</td>
								</tr>
								<tr>
									<th >
									赠送类型：
									</th>
									<td>
										<s:select name="mediaPrice.promotionAType"
											list="promotionATypeList" listKey="id" listValue="datavalue"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td>&nbsp;</td>
									<th>
										&nbsp;
									</th>
									<td>
										<input id="promotionALastValidDate"
											name="mediaPrice.promotionALastValidDate" type="hidden"
											class="text Wdate"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})" 
											style="width: 196px;"
											value="${fn:substring(mediaPrice.promotionALastValidDate,0,10)}"
											readonly="readonly" />
									</td>
									<td>&nbsp;</td>
								</tr>
								<tr>
									<th>
										优惠类型：
									</th>
									<td colspan="5">
										<b style="font-size:13px;color: black">
											<s:radio list="#{'1':'折扣','2':'金额'}" id="saleType_01" name="suiDanSaleType" />&nbsp;(元)
										</b>
									</td>
								</tr>
								</table>
								
								<table border="0" id="suiDan_Tab" cellpadding="4"
									cellspacing="4" width="100%" >
									<s:if test="null != suiDanList && suiDanList.size() > 0">
									<s:iterator id="lr" value="suiDanList" status="i">
									<tr id="${i.index+100}">
										<td width='100%' style='padding-left:175px;'>
											<b style="font-size:14px;color: black">年投放量：&nbsp;
											<input name="suiDan_01" type="text"
													id="suiDanXia${i.index+100}" class="text" 
													style="text-align: center; color: #0078B6;"
													value="<fmt:formatNumber  value='${lr.levelLowerLimit/10000}'  pattern='0'/>" readonly="readonly" maxlength='5'/> &nbsp;万&nbsp;-&nbsp; <input
													type="text" maxlength='5' class="text" name="suiDan_02" id="suiDanShang${i.index+100}"
													style="text-align: center; color: #0078B6;" 
													<c:if test='${!empty lr.levelUpperLimit_01 && lr.levelUpperLimit_01 ne 0.0}'>readonly='readonly'</c:if> 
													value="<c:if test='${!empty lr.levelUpperLimit_01 && lr.levelUpperLimit_01 ne 0.0}'><fmt:formatNumber   value='${lr.levelUpperLimit_01/10000}'  pattern='0'/></c:if>"/>&nbsp;
												万(包含)，优惠额度：&nbsp;<input type="text" class="text"
													name="suiDan_03"
													style="text-align: center; color: #0078B6;" value="<c:if test='${suiDanSaleType eq 1}'><fmt:formatNumber   value='${lr.levelDiscount}' pattern='#.###'/></c:if><c:if test='${suiDanSaleType eq 2}'><fmt:formatNumber value='${lr.levelDiscount}' pattern='#.###'/></c:if>"
													 maxlength='10'/>&nbsp;
											</b>
										</td>
									</tr>
									</s:iterator>
								</s:if>
								<s:else>
									<tr id="100">
										<td width='100%'>
											<b style='font-size:14px;color: black;padding-left:175px;'>年投放量：&nbsp;<input name="suiDan_01" type="text"
													id="suiDanXia100" class="text" 
													style="text-align: center; color: #0078B6;"
													value="0" readonly="readonly" maxlength='5'/> &nbsp;万&nbsp;-&nbsp; <input
													type="text" class="text" name="suiDan_02" id="suiDanShang100"
													style="text-align: center; color: #0078B6;" maxlength='5'/>&nbsp;
												万(包含)，优惠额度：&nbsp;<input type="text" class="text"
													name="suiDan_03"
													style="text-align: center; color: #0078B6;" maxlength='10'/>&nbsp;
											</b>
										</td>
									</tr>
								</s:else>
								</table>
							</div>
						<div id="changGuiDiv" style="<c:if test='${changGuiListSize gt 0}'>display:block;</c:if>
							<c:if test='${changGuiListSize le 0}'>display:none;</c:if>">
							<div class="add_div"
								style="border-left-style: none; border-right-style: none;">
								<table width="100%">
									<tr
										style="height: 30px; font-size: 16px; color: #000000; background: url(<%=path%>/images/banners30.jpg) repeat;">
										<td style="padding-left: 30px;">
											<b>常规赠送</b>&nbsp;&nbsp;&nbsp;
											<input type="button" value="新增" onclick="addChangGui('changGui_Tab');" />
											&nbsp;<input type="button" value="删除" onclick="delChangGui('changGui_Tab');" />
										</td>
									</tr>
								</table>
							</div>
							
							<table class="table_add" width="100%">
									<tr>
									<th style="width: 300px;">
										是否累计：
									</th>
									<td width="200">
										<s:select name="mediaPrice.promotionBAccumulate"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="150">&nbsp;</td>
									<th style="width:250px;">
										时间是否可调：
									</th>
									<td>
										<s:select name="mediaPrice.promotionBValidDateAdjustable"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="250">&nbsp;</td>
								</tr>
								<tr>
									<th >
									赠送类型：
									</th>
									<td>
										<s:select name="mediaPrice.promotionBType"
											list="promotionATypeList" listKey="id" listValue="datavalue"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td>&nbsp;</td>
									<th>
										&nbsp;
									</th>
									<td>
										<input id="promotionBLastValidDate"
											name="mediaPrice.promotionBLastValidDate" type="hidden"
											class="text Wdate"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})" 
											style="width: 196px;"
											value="${fn:substring(mediaPrice.promotionBLastValidDate,0,10)}"
											readonly="readonly" />
									</td>
									<td>&nbsp;</td>
								</tr>
								<tr>
									<th>
										优惠类型：
									</th>
									<td colspan="5">
										<b style="font-size:14px;color: black">
											<s:radio list="#{'1':'折扣','2':'金额'}" id="saleType_02" name="changGuiSaleType" />&nbsp;(元)
										</b>
									</td>
								</tr>
								</table>
							
							<table border="0" id="changGui_Tab" cellpadding="4"
								cellspacing="4" width="100%" >
								<s:if test="null != changGuiList && changGuiList.size() > 0">
								<s:iterator id="cg" value="changGuiList" status="i">
								<tr id="${i.index+200}">
									<td width='100%' style='padding-left:175px;'>
										<b style='font-size:14px;color: black;'>年投放量：&nbsp;<input name="changGui_01"
												type="text" id="changGuiXia${i.index+200}" class="text" 
												style="text-align: center; color: #0078B6;"
												value="<fmt:formatNumber   value='${cg.levelLowerLimit/10000}'  pattern='0'/>" readonly="readonly" maxlength='5'/> &nbsp;万&nbsp;-&nbsp; <input
												type="text" class="text" name="changGui_02"
												id="changGuiShang${i.index+200}" maxlength='5'
												style="text-align: center; color: #0078B6;" 
												<c:if test='${!empty cg.levelUpperLimit_01 && cg.levelUpperLimit_01 ne 0.0}'>readonly='readonly'</c:if>  
												value="<c:if test='${!empty cg.levelUpperLimit_01 && cg.levelUpperLimit_01 ne 0.0}'><fmt:formatNumber   value='${cg.levelUpperLimit_01/10000}'  pattern='0'/></c:if>"/>&nbsp;
											万(包含)，优惠额度：&nbsp;<input type="text" class="text"
												name="changGui_03"
												style="text-align: center; color: #0078B6;" maxlength='10' 
												value="<c:if test='${changGuiSaleType eq 1}'><fmt:formatNumber  value='${cg.levelDiscount}' pattern='#.###'/></c:if><c:if test='${changGuiSaleType eq 2}'><fmt:formatNumber  value='${cg.levelDiscount}' pattern='#.###'/></c:if>"/>&nbsp;
										</b>
									</td>
								</tr>
								</s:iterator>
								</s:if>
								<s:else>
									<tr id="200">
									<td width='100%' style='padding-left:175px;'>
										<b style='font-size:14px;color: black'>年投放量：&nbsp;<input name="changGui_01"
												type="text" id="changGuiXia200" class="text" maxlength='5' 
												style="text-align: center; color: #0078B6;"
												value="0" readonly="readonly" /> &nbsp;万&nbsp;-&nbsp; <input
												type="text" class="text" name="changGui_02"
												id="changGuiShang200" maxlength='5' 
												style="text-align: center; color: #0078B6;" />&nbsp;
											万(包含)，优惠额度：&nbsp;<input type="text" class="text" maxlength='10' 
												name="changGui_03"
												style="text-align: center; color: #0078B6;" />&nbsp;
										</b>
									</td>
								</tr>
								</s:else>
							</table>
						</div>
						
						<div id="hanHuaiDiv" style="<c:if test='${fanHuaiListSize gt 0}'>display:block;</c:if>
							<c:if test='${fanHuaiListSize le 0}'>display:none;</c:if>">
							<div class="add_div"
								style="border-left-style: none; border-right-style: none;">
								<table style="width: 100%;" cellpadding="0" cellspacing="0">
									<tr
										style="height: 30px; font-size: 16px; color: #000000; background: url(<%=path%>/images/banners30.jpg) repeat;">
										<td style="padding-left: 30px;">
											<b>返还赠送</b>
											<span id="fanhuaiBtnDiv">
											<c:if test="${levelID ne 0 && mediaPrice.mediaDiscountType gt 1}">&nbsp;&nbsp;&nbsp;
												<input type="button" value="新增" onclick="addFanHuan('fanHuan_Tab');" />
												&nbsp;<input type="button" value="删除" onclick="delFanHuan('fanHuan_Tab');" />
											</c:if>
											<c:if test="${levelID eq 0 && mediaPrice.mediaDiscountType gt 1}">&nbsp;&nbsp;&nbsp;
												<input type="button" value="新增" onclick="addFanHuan('fanHuan_Tab');" />
												&nbsp;<input type="button" value="删除" onclick="delFanHuan('fanHuan_Tab');" />
											</c:if>
											</span>
										</td>
									</tr>
								</table>
							</div>
							
							<table class="table_add" width="100%">
									<tr>
									<th style="width: 300px;">
										时间是否可调：
									</th>
									<td width="200">
										<s:select name="mediaPrice.promotionCValidDateAdjustable"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="150">&nbsp;</td>
									<th width="250">
										赠送类型：
									</th>
									<td>
										<s:select name="mediaPrice.promotionCType"
											list="promotionATypeList" listKey="id" listValue="datavalue"
											cssStyle="width:200px;">
										</s:select>
									</td>
									<td width="250"><input id="promotionCLastValidDate"
											name="mediaPrice.promotionCLastValidDate" type="hidden"
											class="text Wdate"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})" 
											style="width: 196px;"
											value="${fn:substring(mediaPrice.promotionCLastValidDate,0,10)}"
											readonly="readonly" />
											<div style="display:none;">
										<s:select name="mediaPrice.promotionCLevel"
											list="#{'1':'是','2':'否'}" listKey="key" listValue="value"
											cssStyle="width:200px;">
										</s:select>
										</div>
											</td>
									</tr>
								</table>
							
							<div id="zheKouDivID">
							<c:if test="${levelID ne 0 && mediaPrice.mediaDiscountType gt 1}">
							<table id="fanHuan_Tab" cellpadding="4" cellspacing="4"
								width="100%" >
								<s:if test="null != fanHuaiList && fanHuaiList.size() > 0">
								<s:iterator id="fh" value="fanHuaiList" status="i">
								<tr id="${i.index+400}">
									<td width='100%' style='padding-left:175px;'>
										<b style='font-size:14px;color: black'>年投放量：&nbsp;<input name="fanHuan_01" type="text"
												id="fanHuanXia${i.index+400}" maxlength='5' class="text" 
												style="text-align: center; color: #0078B6;"
												value="<fmt:formatNumber   value='${fh.levelLowerLimit/10000}'  pattern='0'/>" readonly="readonly"/> &nbsp;万&nbsp;-&nbsp; <input
												type="text" class="text" name="fanHuan_02"
												id="fanHuanShang${i.index+400}" maxlength='5' 
												style="text-align: center; color: #0078B6;" 
												<c:if test='${!empty fh.levelUpperLimit_01 && fh.levelUpperLimit_01 ne 0.0}'>readonly='readonly'</c:if>  
												value="<c:if test='${!empty fh.levelUpperLimit_01 && fh.levelUpperLimit_01 ne 0.0}'><fmt:formatNumber  value='${fh.levelUpperLimit_01/10000}'  pattern='0'/></c:if>"/>&nbsp;
											万(包含)，优惠额度：&nbsp;<input type="text" class="text"
												name="fanHuan_03"
												style="text-align: center; color: #0078B6;" maxlength='10' value="<fmt:formatNumber value='${fh.levelDiscount}' pattern='#.###'/>"/>&nbsp;
										</b>
									</td>
								</tr>
								</s:iterator>
								</s:if>
							</table>
							</c:if>
							
							<c:if test="${levelID eq 0 && mediaPrice.mediaDiscountType gt 1}">
							<table id="fanHuan_Tab" cellpadding="4" cellspacing="4" width="100%" >
								<tr id="400">
									<td width='100%' style='padding-left:175px;'>
										<b style='font-size:14px;color: black'>年投放量：&nbsp;<input name="fanHuan_01" type="text"
												id="fanHuanXia400" maxlength='5' class="text" 
												style="text-align: center; color: #0078B6;"
												value="0" readonly="readonly" /> &nbsp;万&nbsp;-&nbsp; <input
												type="text" class="text" name="fanHuan_02"
												id="fanHuanShang400" maxlength='5' 
												style="text-align: center; color: #0078B6;" />&nbsp;
											万(包含)，优惠额度：&nbsp;<input type="text" class="text" maxlength='10'
												name="fanHuan_03"
												style="text-align: center; color: #0078B6;" />&nbsp;
										</b>
									</td>
								</tr>
								</table>
							</c:if>
							
							
							<c:if test="${levelID eq 0 && mediaPrice.mediaDiscountType eq 1}">
								<br/>
								<div style="padding-left: 178px;">
									<b style='font-size:14px;color: black'>优惠额度：
									<input maxlength='5' type='text' class='text' id='eDuValue' value="<fmt:formatNumber value='${eDuValue}' pattern='#.###'/>" name='eDuValue' style='text-align: center; color: #0078B6;' />&nbsp;%</b>
									<br/><br/>
								</div>
							</c:if>
							<div>
						</div>
					</div>
					</div>
					</div>

					<div style="margin: 8px 0 0 150px;">
						<input onclick="return doUpdateMediaPrice('doUpdateMediaAction.action');" type="button" class="btn-title" value="保存" />
						&nbsp;&nbsp;<input type="button" class="btn-title" value="取消"
							onclick="doQuXiao();" />
					</div>
			<div id="dialog" title="合同名称列表" style="display: block;">
				<table width="0" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>
							<input type="text" style="width: 250px" id="contractName"
								class="text" />
							&nbsp;
							<input type="button" class="btn-title" value="搜索"
								onclick="findAllContract();" />&nbsp;
							<input type="button" class="btn-title" value="重置"
										onclick="rewlset();" />	
						</td>
					</tr>
					<tr>
						<td style="padding-top: 5px;">
							<select id="xiangmuId" multiple="multiple"
								style="width:100%; height: 335px;"
								ondblclick="xiangmuDBlclick();">
								<s:iterator id="c" value="contractList">
									<s:if test="mediaPrice.contractID == #c.contractID">
										<option title="${c.contractName}" value="${c.contractID}" selected="selected">
											${c.contractName}
										</option>
									</s:if>
									<s:else>
										<option title="${c.contractName}" value="${c.contractID}">
											${c.contractName}
										</option>
									</s:else>
								</s:iterator>
							</select>

						</td>
					</tr>
				</table>
			</div>
			</div>
			</form>
			<!-- 顶部end -->


		</div>
			<!-- 底部start -->
			<div id="bottom">
				<div class="body">
					<label>
						版权所有&nbsp;&nbsp;&nbsp;&nbsp;2012东莞移动
					</label>
				</div>
			</div>
			<!-- 底部end -->
	</body>
</html>
